package zhangqi.com.messagefast;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
    private EditText et_person ;
    private EditText et_content;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        et_person = (EditText) findViewById(R.id.et_person);
        et_content = (EditText) findViewById(R.id.et_content);
    }
    public void chose(View view) {
        Intent intent = new Intent(MainActivity.this,Main2Activity.class);
        startActivityForResult(intent,10);
    }
    public void fastmessage(View view) {
        Intent intent = new Intent(MainActivity.this,Main3Activity.class);
        startActivityForResult(intent,20);
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        String name = data.getStringExtra("name");
        if(requestCode==10){
            et_person.setText(name);
        }else if(requestCode==20){
            et_content.setText(name);
        }
    }
}
